//
//  UIImage+SnapShotCurrentImage.swift
//  Weibo
//
//  Created by ZhuDong on 16/5/28.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

extension UIImage{
    func snapShotCurrentImage()->UIImage{
        let window = UIApplication.sharedApplication().keyWindow!
        UIGraphicsBeginImageContext(window.bounds.size)
        window.drawViewHierarchyInRect((window.bounds), afterScreenUpdates: false)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image
    }
}